#include "DualServerRecvHandler.h"
#include "DualClientSendHandler.h"

using namespace log4cplus;

Logger DualServerRecvHandler::log=GetLogger(LOG4CPLUS_TEXT("DualServerRecvHandler"));

void DualServerRecvHandler::GetRecvSendInfo(ClientContext &client,SOCKET *recvSock,SOCKET *sendSock,WSABUF **buf,OVERLAPPED **ovl,WSABUF **weakRefBuf)
{
	unsigned int clienSequenceNo=client.SequenceNo();
	LOG4CPLUS_DEBUG_FMT(log,LOG4CPLUS_TEXT("[Client%d]Dual server receive handler set recvsend info."),clienSequenceNo);
	*recvSock=client.DestSock();
	*sendSock=client.SrcSock();
	ClientContextExt &extObj=client.ExtContext();
	*buf=extObj.Buffer2();
	*ovl=extObj.OVL2();
	*weakRefBuf=extObj.WeakRefBuffer2();
}

void DualServerRecvHandler::SetNextHandler(ClientContext &client)
{
	delete client.ExtContext().SetDestHandler(new DualClientSendHandler());
}